<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .classA{
            color: aqua;
        }
        .classB{
            background-color:hotpink;
        }
        .classC{
            font-size:20px ;
        }
    </style>
</head>
<body>
    <div id="demo">
        <h2>calss样式的绑定</h2>
        <p :class="myClass">死去元知万事空</p>
        <p :class="{classB:hasB,classC:hasC}">死去元知万事空</p>
                
        <hr>
        <h2>style的样式绑定</h2>
        <p :style="{color:myColor,backgroundColor:mybck,fontSize:mySize+'px'}">死去元知万事空</p>

        <hr>
        <button @click="updata">切换</button>
    </div>
    <script src="../day02/js/vue.js"></script>
    <script>
        new Vue({
            el:'#demo',
            data:{
                myClass:'classA',
                hasB:true,
                hasC:false,
                myColor:"green",
                mybck:"red",
                mySize:30
            },
            methods:{
                updata(){
                   this.myClass = 'classB',
                   this.hasB = !this.hasB,
                   this.hasC = !this.hasC,
                   this.myColor="red",
                   this.mybck="green",
                   this.mySize +=5;
                }
            }
        })
    </script>
</body>
</html>